# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Arch Haskell Team <arch-haskell@haskell.org>

pkgname=hledger-ui
pkgver=1.28
pkgrel=32
pkgdesc="Curses-style terminal interface for the hledger accounting system"
url="http://hledger.org"
license=("GPL")
arch=('loong64' 'x86_64')
depends=('ghc-libs' 'hledger' 'haskell-hledger-lib' 'haskell-ansi-terminal' 'haskell-async'
         'haskell-cmdargs' 'haskell-data-default' 'haskell-doclayout' 'haskell-extra'
         'haskell-fsnotify' 'haskell-microlens' 'haskell-microlens-platform' 'haskell-megaparsec'
         'haskell-safe' 'haskell-split' 'haskell-text-zipper' 'haskell-vector' 'haskell-brick'
         'haskell-vty')
makedepends=('ghc')
source=("https://hackage.haskell.org/packages/archive/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('eeac3483daee66449706535c1c4e0978ee359bd3ace071d7d208ab2c8b45d7276a478bb9fde7bc60cb83d59c5f6d82008cc87d4c145f4dee18bb667bc5163d0f')

build() {
    cd $pkgname-$pkgver
    runhaskell Setup configure -O --enable-executable-dynamic --disable-library-vanilla \
        --prefix=/usr --docdir="/usr/share/doc/$pkgname" --datasubdir=$pkgname --enable-tests \
            -fthreaded
    runhaskell Setup build $MAKEFLAGS
}

check() {
    cd $pkgname-$pkgver
    runhaskell Setup test --show-details=direct
}

package() {
    cd $pkgname-$pkgver
    runhaskell Setup copy --destdir="$pkgdir"
    rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE

    install -Dm644 hledger-ui.1 -t "$pkgdir"/usr/share/man/man1/
}
